﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="EditProduct.aspx.cs" Inherits="MyShop.EditProduct" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:Panel ID="ProductPrice" runat="server" > 
        <a runat="server" href="~/Admin.aspx?" style=""> Go Back</a>
            <div  style="margin:20px;border: 1px solid #808080;padding:5px;"> Product Price:
        
        
    
                <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="ID" 
                    DataSourceID="SqlDataSource1" BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" 
                    ForeColor="Black" GridLines="Vertical" Width="871px">
                    <AlternatingRowStyle BackColor="White" />
                    <Columns>                
                        <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" Visible="false"/>
                        <asp:BoundField DataField="GroupProduct" HeaderText="Group Product" ReadOnly="True"  SortExpression="GroupID" />
                        <asp:BoundField DataField="Company" HeaderText="Company Product" ReadOnly="True"  SortExpression="CompanyID" />
                        <asp:BoundField DataField="ModelName" HeaderText="Model Name" SortExpression="ModelName" ConvertEmptyStringToNull="False" NullDisplayText="Поле не может быть пустым" />
                        <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                        <asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
                        <asp:BoundField DataField="Count" HeaderText="Count" SortExpression="Count" />
                        <asp:CommandField ShowDeleteButton="True" ShowEditButton="True"/>
                    </Columns>
                    <FooterStyle BackColor="#CCCC99" />
                    <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <RowStyle BackColor="#F7F7DE" />
                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                    <SortedAscendingCellStyle BackColor="#FBFBF2" />
                    <SortedAscendingHeaderStyle BackColor="#848384" />
                    <SortedDescendingCellStyle BackColor="#EAEAD3" />
                    <SortedDescendingHeaderStyle BackColor="#575357" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShopConnectionString %>"
                    UpdateCommand="Update Product SET ModelName=@ModelName, Description=@Description, Price=@Price, Count=@Count WHERE ID=@ID"
                    DeleteCommand="DELETE FROM Product WHERE ID=@ID;"                     
                    SelectCommand="SELECT 
                    Product.ID, 
                    Product.GroupID, 
                    Product.CompanyID, 
                    Product.ModelName, 
                    Product.Description, 
                    Product.Price, 
                    Product.Count, 
                    ProductCompany.Name AS [Company], 
                    ProductGroup.Name AS [GroupProduct]
                    FROM (Product INNER JOIN ProductCompany ON Product.CompanyID=ProductCompany.ID) 
                    INNER JOIN ProductGroup ON Product.GroupID=ProductGroup.ID">
                </asp:SqlDataSource>     
            </div>
        </asp:Panel>
    </div>
    </form>
</body>
</html>
